package cn.wikiflyer.beikang.act.user.adapter;

import java.util.List;

import cn.wikiflyer.beikang.utils.RegionBean;
import android.content.Context;
import kankan.wheel.widget.adapters.AbstractWheelTextAdapter;

public class AddressWheelAdapter extends AbstractWheelTextAdapter {

	// items
	private List<RegionBean> items;

	/**
	 * Constructor
	 * 
	 * @param context
	 *            the current context
	 * @param items
	 *            the items
	 */
	public AddressWheelAdapter(Context context, List<RegionBean> items) {
		super(context);

		// setEmptyItemResource(TEXT_VIEW_ITEM_RESOURCE);
		this.items = items;
	}

	@Override
	public CharSequence getItemText(int index) {
		if (index >= 0 && index < items.size() && items != null) {
			RegionBean item = items.get(index);
			return item.regionName;
		}
		return null;
	}

	@Override
	public int getItemsCount() {
		if (items == null || items.size() == 0) {
			return 1;
		}
		return items.size();
	}

}
